package com.lbs.jiepiaisi.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

import com.lbs.jiepiaisi.R;

/**
 *
 * 时间：2017/11/2 16:09
 * 作用：城市简称
 *
 */

public class ChengShiJianChengActivity extends Activity {

    private LinearLayout liner_close;

    private Button[] btnArray = new Button[22];

    private String jiancheng;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_chengshijiancheng);
        getExras();
        findView();
        setListener();
    }



    public void getExras() {

    }

    public void findView() {
        liner_close= (LinearLayout) findViewById(R.id.liner_close);

        //城市简称
        btnArray[0] = (Button) findViewById(R.id.btn_jing);
        btnArray[1] = (Button) findViewById(R.id.btn_hu);
        btnArray[2] = (Button) findViewById(R.id.btn_chuan);
        btnArray[3] = (Button) findViewById(R.id.btn_zhe);
        btnArray[4] = (Button) findViewById(R.id.btn_min);
        btnArray[5] = (Button) findViewById(R.id.btn_yi);
        btnArray[6] = (Button) findViewById(R.id.btn_ji);
        btnArray[7] = (Button) findViewById(R.id.btn_liao);
        btnArray[8] = (Button) findViewById(R.id.btn_lu);
        btnArray[9] = (Button) findViewById(R.id.btn_hebei_yu);
        btnArray[10] = (Button) findViewById(R.id.btn_su);
        btnArray[11] = (Button) findViewById(R.id.btn_xiang);
        btnArray[12] = (Button) findViewById(R.id.btn_shan);
        btnArray[13] = (Button) findViewById(R.id.btn_yue);
        btnArray[14] = (Button) findViewById(R.id.btn_e);
        btnArray[15] = (Button) findViewById(R.id.btn_wan);
        btnArray[16] = (Button) findViewById(R.id.btn_yun);
        btnArray[17] = (Button) findViewById(R.id.btn_xin);
        btnArray[18] = (Button) findViewById(R.id.btn_ning);
        btnArray[19] = (Button) findViewById(R.id.btn_qiong);
        btnArray[20] = (Button) findViewById(R.id.btn_yu);
        btnArray[21] = (Button) findViewById(R.id.btn_jin);

    }

    public void setListener() {
        liner_close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ChengShiJianChengActivity.this.finish();
            }
        });
        //京
        btnArray[0].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiancheng="京";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //沪
        btnArray[1].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiancheng="沪";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //川
        btnArray[2].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiancheng="川";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //浙
        btnArray[3].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiancheng="浙";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //闽
        btnArray[4].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiancheng="闽";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //翼
        btnArray[5].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiancheng="翼";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //吉
        btnArray[6].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                jiancheng="吉";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //辽
        btnArray[7].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                jiancheng="吉";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //鲁
        btnArray[8].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiancheng="鲁";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //豫
        btnArray[9].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                jiancheng="豫";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //苏
        btnArray[10].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                jiancheng="苏";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //湘
        btnArray[11].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                jiancheng="湘";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //陕
        btnArray[12].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                jiancheng="陕";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //粤
        btnArray[13].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                jiancheng="粤";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //鄂
        btnArray[14].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                jiancheng="鄂";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //皖
        btnArray[15].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiancheng="皖";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //云
        btnArray[16].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiancheng="云";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //新
        btnArray[17].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiancheng="新";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //宁
        btnArray[18].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                jiancheng="宁";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //琼
        btnArray[19].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                jiancheng="琼";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //渝
        btnArray[20].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                jiancheng="渝";
                //数据是使用Intent返回
                Intent intent = new Intent();
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);
                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });
        //津
        btnArray[21].setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                jiancheng="津";
                //数据是使用Intent返回
                Intent intent = new Intent();

                Log.e("TAG","未传前的简称："+jiancheng);
                //把返回数据存入Intent
                intent.putExtra("resultView",jiancheng);

                ChengShiJianChengActivity.this.setResult(0,intent);
                finish();
            }
        });



    }
}
